package com.hsjk.szwj.module.train.controller.admin;

import com.hsjk.szwj.framework.common.pojo.CommonResult;
import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.module.train.controller.admin.vo.AdminStudentPageReqVO;
import com.hsjk.szwj.module.train.controller.admin.vo.AdminStudentPageRespVO;
import com.hsjk.szwj.module.train.service.IStudentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.hsjk.szwj.framework.common.pojo.CommonResult.success;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/09/10 00:28
 **/
@Tag(name = "后台管理 - 正式学员")
@RestController
@RequestMapping("/train/student")
@Validated
@Slf4j
public class AdminStudentController {
    @Resource
    private IStudentService studentService;

    @GetMapping("/page")
    @Operation(summary = "/获得正式学员分页列表")
    @PreAuthorize("@ss.hasPermission('train:student:query')")
    public CommonResult<PageResult<AdminStudentPageRespVO>> getStudentPageList(@Valid AdminStudentPageReqVO reqVO) {
        return success(studentService.getStudentPageList(reqVO));
    }
}
